<?php

abstract class Roles
{
	private static $Roles;
	
	public static function Add($Roles)
	{
		self::$Roles = $Roles;
	}
	
	public static function Inherit($MotherRole, $ChildRole)
	{
		$Result = array_merge(self::$Roles[$MotherRole], self::$Roles[$ChildRole]);
		self::$Roles[$MotherRole] = $Result;
	}
	
	public static function Debug()
	{
		print "<pre>"; print_r(self::$Roles); print "</pre>";
	}
	
	public static function Check($Permission, $Role)
	{
		if (in_array($Permission, self::$Roles[$Role]))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}